import { _decorator, Component, Node, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('PlayerWeapon')
export class PlayerWeapon extends Component {
    speed: number = 5;
    direction: Vec3 = new Vec3();
    isMoving: boolean = false;

    start() {
        
    }

    update(deltaTime: number) {
        if (!this.isMoving) {
            return;
        }
        this.node.setPosition(
            this.node.position.x + this.direction.x * this.speed,
            this.node.position.y + this.direction.y * this.speed,
        );
        if (this.node.position.x < -700 || this.node.position.x > 700 || this.node.position.y < -500 || this.node.position.y > 500) {
            this.node.destroy();
        }
    }
}


